
using UnityEngine;

namespace WooEngine.Extends.Root
{

    public class LogicRoot : MonoBehaviour
    {
        public Camera LogicCamera;
        public Camera RTCamera;
        public Transform LogicCanvas;

        public void RTSwtich(bool isOn, Vector3 pos, RenderTexture rt = null)
        {
            if (isOn)
            {
                RTCamera.gameObject.SetActive(true);
                RTCamera.targetTexture = rt;
                RTCamera.Render();
                RenderTexture.active = rt;
            }
            else
            {
                RTCamera.targetTexture = null;
                RenderTexture.active = null;
                RTCamera.gameObject.SetActive(false);
            }
            RTCamera.transform.position = pos;
            RTCamera.transform.localPosition -= RTCamera.transform.forward * 5;
        }
    }
}